feat(motoko): migrate templates to @dfinity/motoko@v5.0.0 and bump moc to 1.9.0#28
Merged
Conversation
This was referenced May 26, 2026
marc0olo
added a commit
to dfinity/icp-cli-recipes
that referenced
this pull request
Jun 9, 2026
## Summary
- Replaces direct `moc` invocation with `mops build`, aligning the
Motoko recipe with how the Rust recipe delegates to `cargo build`
- Toolchain, dependencies, compiler flags, candid, and per-canister args
all move to `mops.toml` — the recipe retains only icp-specific concerns
(output path, `moc:version`/`template:type` metadata, shrink, compress)
- Removes `main`, `candid`, and `args` recipe params — no replacement
needed, the canister name is injected automatically via
`{{_.canister.name}}`
## Breaking change
| Removed from `icp.yaml` | Moves to `mops.toml` |
|--------------------------|---------------------------------------------------|
| `main: src/main.mo` | `[canisters.backend] main = "src/main.mo"` |
| `candid: backend.did` | `[canisters.backend] candid = "backend.did"` |
| `args: --default-persistent-actors` | `[canisters.backend] args =
["--default-persistent-actors"]` |
New `icp.yaml` — no `configuration:` block needed:
```yaml
canisters:
- name: backend
recipe:
type: "@dfinity/motoko@<version>"
```
New `mops.toml` — canister name must match `icp.yaml`:
```toml
[toolchain]
moc = "1.9.0"
[canisters.backend]
main = "src/main.mo"
candid = "backend.did"
```
## Test plan
- [ ] Build a canister using `mops build` with a matching `[canisters]`
entry in `mops.toml`
- [ ] Confirm `moc:version` and `template:type` metadata are present in
the output WASM
- [ ] Confirm `[moc] args` from `mops.toml` are respected (e.g.
`--default-persistent-actors`)
- [ ] Confirm `shrink` and `compress` options still work
- [ ] Confirm a clear error is shown when the `[canisters]` entry is
missing
> **Note:** `icp-cli-templates` needs a follow-up update to add
`[canisters]` to all Motoko `mops.toml` files. Tracked in
dfinity/icp-cli-templates#27 / dfinity/icp-cli-templates#28.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
…recipe Move canister definitions (main, candid) from icp.yaml/canister.yaml into mops.toml [canisters] sections and replace main/candid recipe params with a single `name` param, as required by the new mops build-based recipe. Bumps moc toolchain to 1.8.2 across all three Motoko templates. Closes #27 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
With _.canister.name now injected automatically by icp-cli (see dfinity/icp-cli#567), the `name` configuration param is no longer needed in recipe configs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
b78f22c to
f061873
Compare
adamspofford-dfinity
approved these changes
Jun 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrates all three Motoko templates to
@dfinity/motoko@v5.0.0, which delegates compilation tomops buildand requires canister definitions to live inmops.toml. Also bumps themoctoolchain to1.9.0across all templates.Templates updated:
motoko/— upgrades recipe tov5.0.0; adds[canisters]inmops.toml; removesmain/candidfromicp.yamlhello-world/motoko-backend/— upgrades recipe tov5.0.0; adds[canisters.backend]inmops.toml; removesmain/candidfromcanister.yamlbitcoin-starter/motoko-backend/— same as hello-world; preserves existing[dependencies]sectionCloses #27
Migration guide (before/after)
icp.yaml/canister.yaml)mops.toml)main: src/main.mo[canisters.backend] main = "src/main.mo"candid: backend.did[canisters.backend] candid = "backend.did"args: --incremental-gc[canisters.backend] args = ["--incremental-gc"]The canister name in
icp.yamlis used automatically — noname:param needed in the recipe configuration.Testing
Verified with
icp new --branch feat/motoko-v5-mops-canistersfor all three templates:motokohello-world(motoko backend + react frontend)bitcoin-starter(motoko backend)mops buildconfirmed)🤖 Generated with Claude Code